home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / Terminals.h < prev    next >
Text File  |  1991-05-01  |  7KB  |  263 lines

  1. /*
  2.     File:        Terminals.h
  3.  
  4.     Contains:    C Interface to the Terminal Manager
  5.  
  6.     Copyright:    © 1988-1990 by Apple Computer, Inc.
  7.                 All rights reserved.
  8.  
  9. */
  10.  
  11.  
  12. #ifndef __TERMINALS__
  13. #define __TERMINALS__
  14.  
  15. #ifndef __DIALOGS__
  16. #include <Dialogs.h>
  17. #endif    __DIALOGS__
  18.  
  19. #ifndef __GEOMETRY__
  20. #include <Geometry.h>
  21. #endif
  22.  
  23. #ifndef __CTBUTILITIES__
  24. #include <CTBUtilities.h>
  25. #endif    __CTBUTILITIES__
  26.  
  27. #ifndef __CONNECTIONS__
  28. #include <Connections.h>
  29. #endif    __CONNECTIONS__
  30.  
  31. /* current Terminal Manager version     */
  32. #define        curTMVersion    2
  33.  
  34. /* current Terminal Manager Environment Record version     */
  35.  
  36. #define        curTermEnvRecVers    0
  37.  
  38. /* error codes    */
  39. typedef    OSErr TMErr;
  40.  
  41. #define    tmGenericError        (-1)
  42. #define    tmNoErr                0
  43. #define    tmNotSent            1
  44. #define    tmEnvironsChanged    2
  45. #define    tmNotSupported        7
  46. #define    tmNoTools            8
  47.  
  48. /* TMFlags     */
  49. typedef long TMFlags;
  50.  
  51. enum {
  52.     tmInvisible         = 1 << 0,
  53.     tmSaveBeforeClear     = 1 << 1,
  54.     tmNoMenus             = 1 << 2,
  55.     tmAutoScroll         = 1 << 3
  56. };
  57.  
  58. /* TMSelTypes & TMSearchTypes    */
  59. typedef short TMSelTypes;
  60. typedef short TMSearchTypes;
  61.  
  62. enum {
  63.     selTextNormal         = 1 << 0,
  64.     selTextBoxed         = 1 << 1,
  65.     selGraphicsMarquee     = 1 << 2,
  66.     selGraphicsLasso     = 1 << 3,
  67.     
  68.     tmSearchNoDiacrit     = 1 << 8,            /*    These are only for TMSearchTypes    */
  69.     tmSearchNoCase         = 1 << 9
  70. };
  71.  
  72. /*    TMCursorTypes     */
  73. typedef short TMCursorTypes;
  74. enum {
  75.     cursorText = 1,
  76.     cursorGraphics = 2
  77. };
  78.  
  79. /*    TMTermTypes     */
  80. typedef short TMTermTypes;
  81. enum {
  82.     tmTextTerminal         = 1 << 0,
  83.     tmGraphicsTerminal     = 1 << 1
  84. };
  85.  
  86. struct    TermDataBlock {
  87.     TMTermTypes        flags;    
  88.     Handle            theData;
  89.     Handle            auxData;
  90.     long            reserved;
  91. };
  92.  
  93. typedef struct TermDataBlock TermDataBlock;
  94. typedef TermDataBlock *TermDataBlockPtr, **TermDataBlockH;
  95.  
  96. struct TermEnvironRec {
  97.     short            version;
  98.     TMTermTypes        termType;
  99.     short            textRows;
  100.     short            textCols;
  101.     Point            cellSize;
  102.     Rect            graphicSize;
  103.     Point            slop;
  104.     Rect            auxSpace;
  105. };
  106.  
  107. typedef TermEnvironRec *TermEnvironPtr;
  108.     
  109. union TMSelection {
  110.     SimpleRect        selRect;
  111.     RgnHandle        selRgnHandle;
  112. };
  113.  
  114. /* TMChoose data structures */
  115. struct TMChooseRec {
  116.     long    reserved;
  117.     long    msg;
  118.     ProcPtr    idleProc;
  119.     ProcPtr    filterProc;
  120.     Str63    newTool;
  121.     Ptr        newConfig;
  122.     ProcPtr    eventProc;
  123. };
  124.  
  125. typedef TMChooseRec *TMChooseRecPtr;
  126.  
  127. /* TMChooseRec messages */
  128. #define    tmChooseNochange        1
  129. #define    tmChooseBackdoor        2
  130.  
  131. struct TermRecord {
  132.         short            procID;
  133.         
  134.         TMFlags            flags;
  135.         TMErr            errCode;
  136.         
  137.         long            refCon;
  138.         long            userData;
  139.         
  140.         ProcPtr            defProc;
  141.         
  142.         Ptr                config;
  143.         Ptr                oldConfig;
  144.         
  145.         ProcPtr            environsProc;
  146.         long            reserved1;
  147.         long            reserved2;
  148.     
  149.         Ptr                tmPrivate;
  150.                         
  151.         ProcPtr            sendProc;
  152.         ProcPtr            breakProc;
  153.         ProcPtr            cacheProc;
  154.         ProcPtr            clikLoop;
  155.         
  156.         WindowPtr        owner;
  157.         Rect            termRect;
  158.         Rect            viewRect;
  159.         Rect            visRect;
  160.         
  161.         long            lastIdle;
  162.         
  163.         TMSelection        selection;
  164.         TMSelTypes        selType;
  165.         
  166.         long            mluField;
  167. };
  168.  
  169. typedef TermRecord **TermHandle, *TermPtr;
  170.  
  171. #ifdef __cplusplus
  172. extern "C" {
  173. #endif
  174. pascal TMErr     InitTM(void); 
  175. pascal Handle     TMGetVersion(TermHandle hTerm);
  176. pascal short     TMGetTMVersion(void);
  177.  
  178. pascal TermHandle TMNew(const Rect& termRect, const Rect& viewRect, TMFlags flags, 
  179.                             short procID, WindowPtr owner, ProcPtr sendProc, 
  180.                             ProcPtr cacheProc, ProcPtr breakProc, ProcPtr clikLoop, ProcPtr environsProc,
  181.                             long refCon, long userData);
  182.  
  183. pascal void     TMDispose(TermHandle hTerm);
  184.  
  185. pascal void     TMKey(TermHandle hTerm, const EventRecord& theEvent);
  186. pascal void     TMUpdate(TermHandle hTerm, RgnHandle visRgn);
  187. pascal void     TMPaint(TermHandle hTerm, const TermDataBlock& theTermData, const Rect& theRect);
  188. pascal void     TMActivate(TermHandle hTerm, Boolean activate);
  189. pascal void     TMResume(TermHandle hTerm, Boolean resume);
  190. pascal void     TMClick(TermHandle hTerm, const EventRecord& theEvent);
  191. pascal void     TMIdle(TermHandle hTerm);
  192.  
  193. pascal long     TMStream(TermHandle hTerm, void *theBuffer, long theLength, CMFlags flags);
  194. pascal Boolean     TMMenu(TermHandle hTerm, short menuID, short item);
  195.  
  196. pascal void     TMReset(TermHandle hTerm);
  197. pascal void     TMClear(TermHandle hTerm);
  198.  
  199. pascal void        TMResize(TermHandle hTerm, const Rect& newViewRect);
  200.  
  201. pascal long     TMGetSelect(TermHandle hTerm, Handle theData, ResType& theType);
  202. pascal void     TMGetLine(TermHandle hTerm, short lineNo, TermDataBlock& theTermData);
  203. pascal void     TMSetSelection(TermHandle hTerm, const TMSelection& theSelection, TMSelTypes selType);
  204.  
  205. pascal void     TMScroll(TermHandle hTerm, short dh, short dv);
  206.  
  207.  
  208. pascal Boolean     TMValidate(TermHandle hTerm);
  209. pascal void         TMDefault(Ptr& theConfig, short procID, Boolean allocate);
  210.  
  211. pascal Handle     TMSetupPreflight(short procID, long& magicCookie);
  212. pascal void     TMSetupSetup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  213.                     long& magicCookie);
  214. pascal Boolean     TMSetupFilter(short procID, const void *theConfig, short count, DialogPtr theDialog,
  215.                     EventRecord& theEvent, short& theItem, long& magicCookie);
  216. pascal void     TMSetupItem(short procID, const void *theConfig, short count, DialogPtr theDialog,
  217.                     short& theItem, long& magicCookie);
  218. pascal void     TMSetupCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  219.                     long& magicCookie);
  220. pascal void     TMSetupXCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog,
  221.                     Boolean OKed, long& magicCookie );
  222. pascal void     TMSetupPostflight(short procID);
  223.  
  224. pascal Ptr         TMGetConfig(TermHandle hTerm);
  225. pascal short     TMSetConfig(TermHandle hTerm, const void *thePtr);
  226.  
  227. pascal OSErr     TMIntlToEnglish(TermHandle hTerm, const void *inputPtr, Ptr& outputPtr, short language);
  228. pascal OSErr     TMEnglishToIntl(TermHandle hTerm, const void *inputPtr, Ptr& outputPtr, short language);
  229.  
  230. pascal void     TMGetToolName(short id, Str255 name);
  231. pascal short     TMGetProcID(ConstStr255Param name);
  232.  
  233. pascal void     TMSetRefCon(TermHandle hTerm, long refCon);
  234. pascal long     TMGetRefCon(TermHandle hTerm);
  235.  
  236. pascal void     TMSetUserData(TermHandle hTerm, long userData);
  237. pascal long     TMGetUserData(TermHandle hTerm);
  238.  
  239. pascal short     TMAddSearch(TermHandle hTerm, ConstStr255Param theString, const Rect& where, 
  240.                             TMSearchTypes searchType, ProcPtr callBack);
  241. pascal void     TMRemoveSearch(TermHandle hTerm, short refnum);
  242. pascal void     TMClearSearch(TermHandle hTerm);
  243.  
  244. pascal Point     TMGetCursor(TermHandle hTerm, TMCursorTypes cursType);
  245.  
  246. pascal TMErr     TMGetTermEnvirons(TermHandle hTerm, TermEnvironRec& theEnvirons);
  247.  
  248. pascal short     TMChoose(TermHandle& hTerm, Point where, ProcPtr idleProc);
  249. pascal short     TMPChoose(TermHandle& hTerm, Point where, TMChooseRec& cRec);
  250. pascal void     TMEvent(TermHandle hTerm, const EventRecord& theEvent);
  251.  
  252. pascal Boolean     TMDoTermKey(TermHandle hTerm, ConstStr255Param theKey);
  253. pascal short     TMCountTermKeys(TermHandle hTerm);
  254. pascal void     TMGetIndTermKey(TermHandle hTerm, short id, Str255& theKey);
  255.  
  256. pascal void        TMGetErrorString(TermHandle hTerm, short id, Str255& errMsg);
  257.  
  258. #ifdef __cplusplus
  259. }
  260. #endif
  261.  
  262. #endif __TERMINALS__
  263.